package diaosidadui.test;

public class LeastMoney {

    /*
    某小伙想定一份外卖,商家的优惠方式如下:鱼香肉丝单点24元,油炸花生米单点8元,米饭单点3元。

订单满30元8折优惠。鱼香肉丝优惠价16元,但是优惠价和折扣不能同时使用,那么这个小伙要点这三样东西,最		少要花多少钱?请编写程序计算。
        1.三个变量fish=24  peanut=8  rice=3

        2.单点的价格sum= fish+peanut+rice      choice2 = fish+peanut+rice-8
        3.比较choice1  choice2
     */
    public static void main(String[] args) {
        int fish = 24, peanut = 8, rice = 3;
        double sum = fish + peanut + rice ;
//        double choice2 = fish + peanut + rice - 8;
//        double least = choice1 < choice2 ? choice1 : choice2;
//        System.out.println("吃饭最少花:" + least);
            double tempChoice1= sum>30? (sum*0.8):sum ;
            double tempChoice2= fish+peanut+rice-8;
        double lastChoice = tempChoice1 > tempChoice2 ? tempChoice2 : tempChoice1;
        System.out.println(lastChoice);
    }


}
